<!DOCTYPE html>
<!--suppress HtmlUnknownAttribute -->
<html lang="zh-Hans-CN" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header"/>
  <title>修改井信息</title>
</head>
<body>
<form action="javascript:void(0);" class="layui-form" th:object="${well}">
  <div class="mainBox">
    <div class="main-container">
      <input name="id" th:field="*{id}" type="hidden">

      <div class="layui-form-item">
        <label class="layui-form-label">井名称</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="name" placeholder="请输入名称"
                 type="text" th:field="*{name}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">原始编号</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="originCode" placeholder="请输入原编号"
                 type="text" th:field="*{originCode}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label for="wellType" class="layui-form-label">井类型</label>
        <div class="layui-input-block">
          <select id="wellType" name="wellType" lay-verify="required">
            <option th:each="type: ${T(top.vuhe.domain.well.WellType).values()}"
                    th:value="${type.name()}" th:selected="${well.wellType eq type}"
                    th:text="${type.tag}"></option>
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">井区域</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <select name="regionId" lay-verify="required">
            <option value=""></option>
            <option th:each="region:${regions}" th:value="${region.id}"
                    th:selected="${well.regionId eq region.id}"
                    th:text="${region.city} + '-' + ${region.county}">城市-区域
            </option>
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">乡镇(街道办)</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="street" placeholder="请输入乡镇"
                 type="text" th:field="*{street}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">村(街)</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="address" placeholder="请输入村(街)"
                 type="text" th:field="*{address}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">所属单位</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="company" placeholder="请输入所属单位"
                 type="text" th:field="*{company}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">建井时间</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input id="digTime" class="layui-input" lay-verify="required" name="digTime"
                 th:value="${#temporals.format(well.digTime, 'yyyy-MM-dd')}"
                 placeholder="请输入时间" type="text"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">联系人</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="contacts" placeholder="请输入联系人"
                 type="text" th:field="*{contacts}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">联系电话</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="phone" placeholder="请输入联系电话"
                 type="text" th:field="*{phone}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">废弃原因</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="abandonRemark" placeholder="请输入废弃原因"
                 type="text" th:field="*{abandonRemark}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">废弃时间</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input id="abandonTime" class="layui-input" lay-verify="required" name="abandonTime"
                 th:value="${#temporals.format(well.abandonTime, 'yyyy-MM-dd')}"
                 placeholder="请输入时间" type="text"/>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label class="layui-form-label">经度</label>
          <div class="layui-input-inline" style="width: 100px;">
            <!--suppress HtmlFormInputWithoutLabel -->
            <input type="text" name="lng1" placeholder="度" autocomplete="off"
                   th:field="*{lng1}" class="layui-input">
          </div>
          <div class="layui-form-mid">°</div>
          <div class="layui-input-inline" style="width: 100px;">
            <!--suppress HtmlFormInputWithoutLabel -->
            <input type="text" name="lng2" placeholder="分" autocomplete="off"
                   th:field="*{lng2}" class="layui-input">
          </div>
          <div class="layui-form-mid">'</div>
          <div class="layui-input-inline" style="width: 100px;">
            <!--suppress HtmlFormInputWithoutLabel -->
            <input type="text" name="lng3" placeholder="秒" autocomplete="off"
                   th:field="*{lng3}" class="layui-input">
          </div>
          <div class="layui-form-mid">"</div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label class="layui-form-label">纬度</label>
          <div class="layui-input-inline" style="width: 100px;">
            <!--suppress HtmlFormInputWithoutLabel -->
            <input type="text" name="lat1" placeholder="度" autocomplete="off"
                   th:field="*{lat1}" class="layui-input">
          </div>
          <div class="layui-form-mid">°</div>
          <div class="layui-input-inline" style="width: 100px;">
            <!--suppress HtmlFormInputWithoutLabel -->
            <input type="text" name="lat2" placeholder="分" autocomplete="off"
                   th:field="*{lat2}" class="layui-input">
          </div>
          <div class="layui-form-mid">'</div>
          <div class="layui-input-inline" style="width: 100px;">
            <!--suppress HtmlFormInputWithoutLabel -->
            <input type="text" name="lat3" placeholder="秒" autocomplete="off"
                   th:field="*{lat3}" class="layui-input">
          </div>
          <div class="layui-form-mid">"</div>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">填表人</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="informer" placeholder="请输入填表人"
                 type="text" th:field="*{informer}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">排查人</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input class="layui-input" lay-verify="required" name="investigator" placeholder="请输入排查人"
                 type="text" th:field="*{investigator}"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">填表时间</label>
        <div class="layui-input-block">
          <!--suppress HtmlFormInputWithoutLabel -->
          <input id="informTime" class="layui-input" lay-verify="required" name="informTime"
                 th:value="${#temporals.format(well.informTime, 'yyyy-MM-dd')}"
                 placeholder="请输入时间" type="text"/>
        </div>
      </div>
      <div class="layui-form-item">
        <label for="remark" class="layui-form-label">注释</label>
        <div class="layui-input-block">
          <textarea id="remark" class="layui-textarea" name="remark" placeholder="请输入注释"
                    th:value="${well.remark}" type="text"></textarea>
        </div>
      </div>

    </div>
  </div>
  <div class="bottom">
    <div class="button-container">
      <button class="pear-btn pear-btn-primary pear-btn-sm" lay-filter="well-info-save" lay-submit="" type="submit">
        <i class="layui-icon layui-icon-ok"></i>
        提交
      </button>
      <button class="pear-btn pear-btn-sm" type="reset">
        <i class="layui-icon layui-icon-refresh"></i>
        重置
      </button>
    </div>
  </div>
</form>
</body>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">

  layui.use(['form', 'jquery', 'dictionary', 'laydate'], function () {
    let form = layui.form;
    let layDate = layui.laydate;
    let $ = layui.jquery;

    let prefix = "/well/info/";

    layDate.render({
      elem: '#digTime',
      format: 'yyyy-MM-dd'
    });

    layDate.render({
      elem: '#abandonTime',
      format: 'yyyy-MM-dd'
    });

    layDate.render({
      elem: '#informTime',
      format: 'yyyy-MM-dd'
    });

    form.on('submit(well-info-save)', function (data) {
      $.ajax({
        url: prefix + 'update',
        data: JSON.stringify(data.field),
        dataType: 'json',
        contentType: 'application/json',
        type: 'put',
        success: function (result) {
          if (result.success) {
            layer.msg(result.msg, {icon: 1, time: 1000}, function () {
              parent.layer.close(parent.layer.getFrameIndex(window.name));
              parent.layui.table.reload("well-info-table");
            });
          } else {
            layer.msg(result.msg, {icon: 2, time: 1000});
          }
        }
      })
      return false;
    });
  });
</script>
</html>
